<extend name="./Application/Admin/View/base.html" />
<block name="title"><title><?php echo C(APP_NAME);?>PC端管理</title></block>
<block name="stylesheets">
<link rel="stylesheet" href="__PUBLIC__/assets/css/jquery-ui.css" />
</block>
<block name="stylecss">
<style type='text/css'>
	.pages a,.pages span {
	    display:inline-block;
	    padding:5px 9px;
	    margin:0 1px;
	    border:1px solid #f0f0f0;
	}
	.pages a,.pages li {
	    display:inline-block;
	    list-style: none;
	    text-decoration:none; color:#58A0D3;
	}
	.pages a.first,.pages a.prev,.pages a.next,.pages a.end{
	    margin:0;
	}
	.pages a:hover{
	    border-color:#50A8E6;
	}
	.pages span.current{
	    background:#50A8E6;
	    color:#FFF;
	    font-weight:700;
	    border-color:#50A8E6;
	}
</style>
</block>
<block name="smallmenu">
<ul class="breadcrumb">
	<li>
		<i class="ace-icon fa fa-home home-icon"></i>
		<a href="#">主页</a>
	</li>

	<li class="active">订单列表</li>
</ul><!-- /.breadcrumb -->

</block>
<block name="content">
	<div class="accordion" id="accordion2" style="border:1px solid #cccccc;padding:10px;border-radius:8px;margin-bottom:10px">
		<div class="accordion-group">
			<div class="accordion-heading">
				<a class="accordion-toggle collapsed" style="font-size:14px;" data-toggle="collapse" data-parent="#accordion2" href="#collapseSelect"> 请选择查询条件 </a>
			</div>
				<div id="collapseSelect" class="accordion-body collapse" style="height: 0px;padding-top:10px">
					<div class="accordion-inner">
						<form action="" id="form" name="selectUserForm" method="get">
							<input type="hidden" name="p" value="1">
							<table class="table" style="margin:0">
								<tr>
									<td>订单编号： <input name="order_num" type="text" /></td>
									<td>MIDI ID： <input name="user_id" type="text" /></td>
									<td>昵称： <input name="user_nickname" type="text" /></td>
									<td>订单状态： <select name="order_paystatus" id=""><option value="0">-请选择-</option><option value="1">未付款</option><option value="2">已付款未发货</option><option value="3">已付款已发货</option></select></td>
									<td><button class="btn btn-sm btn-success" type="submit">查询</button></td>
								</tr>
							</table>

						</form>
					</div>
				</div>
		</div>
	</div>
	<input type="hidden" id="crontab-s" />
	<table id="sample-table-1" class="table table-striped table-bordered table-hover">
		<thead>
			<tr>
			    <th class="center">编号</th>
				<th class="center">订单编号</th>
				<th class="center">迷笛ID</th>
				<th class="center">昵称</th>
				<th class="center">总价</th>
				<th class="center">订单状态</th>
				<th class="center"><i class="ace-icon fa fa-clock-o bigger-110 hidden-480"></i>下单时间</th>
				<th class="center">操作</th>
			</tr>
		</thead>

		<tbody>
			<foreach name="order_arr" item="v">
			<tr style="text-align:center">
				<td class="center">{$key+1}</td>
				<td>{$v.order_num}</td>
				<td>{$v.user_id|formatNO=6}</td>
				<td>{$v.user_nickname}</td>
				<td>{$v.order_totalprice}元</td>
				<td>
					<if condition="$v.order_paystatus eq '1'">
						<span style="color:red">未付款</span>
					<elseif condition="$v.order_paystatus eq '2'" />
						<span style="color:yellow">已付款未发货</span>
					<elseif condition="$v.order_paystatus eq '3'" />
						<span style="color:green">已付款已发货</span>
				    <else />
				        <span>未知</span>
				    </if>
				</td>
				<td>{$v.order_createtime|date='Y-m-d H:i:s',###}</td>
				<td>
					<div class="hidden-sm hidden-xs btn-group">
						<div class="hidden-sm hidden-xs action-buttons">

							<a class="blue" style='cursor:pointer' title='查看订单信息'onClick='location.href="__CONTROLLER__/order_details/order_id/{$v.order_id}"'>
								<i class="ace-icon fa fa-search-plus bigger-130"></i>
							</a>

							<a class="green" style='cursor:pointer' data-toggle="modal" data-target="#myModal" onClick="edit({$v.order_id})" title='修改订单状态'>
								<i class="ace-icon fa fa-pencil bigger-130"></i>
							</a>

						</div>
					</div>
				</td>
			</tr>
		    </foreach>
		</tbody>
	</table>
<div class="pages" style="float:right">{$page}</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<form id="form" action="__CONTROLLER__/order_edit" method="post" class="myformedit">
	<input type="hidden" name="action" value="order_edit_action">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">修改订单状态</h4>
            </div>
            <div class="modal-body">
            <table class="table">
                <tr>
                    <th>订单状态</th>
                    <th>快递公司简称</th>
                    <th>快递运单号</th>
                </tr>
                <tr><input type="hidden" name="order_id" id="order_id">
                    <td class="col-xs-4">
                    	<select name="order_paystatus" id="order_paystatus" class="col-xs-10">
                        <option value="">-请选择-</option>
                        <option value="1">未付款</option>
                        <option value="2">已付款未发货</option>
                        <option value="3">已付款已发货</option>
                    </select><br />
                    <span class="Validform_checktip">必选项</span>
                    </td>
                    <td class="col-xs-4"><input type="text" name="order_express_com" id="order_express_com" class="ninputxt" placeholder="简称可在快递公司列表中查到">
                    <span class="Validform_checktip">必填项</span>
                    </td>
                    <td class="col-xs-4"><input type="text" name="order_express_no" id="order_express_no" class="ninputxt">
                    <span class="Validform_checktip">必填项</span>
                    </td>
                </tr>
            </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="submit" class="btn btn-primary">提交</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</form>
</div>
</block>
<block name="scripts"></block>
<block name="jscript">
<script script="text/javascript">
    $(function(){
        $('#menu_order').addClass('active open');
        $('#menu_order_list').addClass('active');
    });
</script>
<script>
    function edit(orderId) {
        $.post("__CONTROLLER__/order_edit",{"order_id":orderId},function(t){
            $("#order_paystatus option[value='"+t.order_paystatus+"']").attr("selected", true);
            $("#order_express_com").val(t.order_express_com);
            $("#order_express_no").val(t.order_express_no);
            $("#order_id").val(t.order_id);
            $('#myModal').modal('show');
        },'json');
    }
</script>
</block>